/*
 * @LastEditors: yuSeen
 * @LastEditTime: 2021-12-23 13:56:52
 */
import request from '../../request'
import type { qrKey, LoginQrcode } from './types'

// 获取登录key和二维码
export async function getLoginQrcode() {
    const { data: { unikey } } = await request.get<qrKey>('/login/qr/key', null, false)
    const params = {
        key: unikey,
        qrimg: 1
    }
    const res = await request.post<LoginQrcode>('/login/qr/create', params, false)
    res.data.key = unikey
    return res
}

// 获取扫码登录的状态
export function getLoginQrcodeStatus(key: string) {
    return request.post<{[name: string]: any}>('/login/qr/check', {key}, false)
}
